package camtburist.app02.dao;

import camtburist.app02.bean.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ArticleMapper {
    @Select("select * from cms_article")
    List<Article> selectAll();

    @Insert("insert into cms_article values(null,#{title},#{content},#{publishDate},#{readTimes},#{thumbUpTimes},#{thumbDownTies},#{status},#{categoryId},#{userId})")
    void insert(Article article);

    @Update("update cms_article set title=#{title},content#{content},publish_date=#{publishDate},read_times=#{readTimes},thumbUp_times=#{thumbUpTimes},thumb_down_ties=#{thumbDownTies},status=#{status},category_id=#{categoryId},user_id=#{userId} where id={id}")
    void update(Article article);

    @Delete("delete from cms_article where id=#{id}")
    void deleteById(long id);



}
